/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.util.Formatter;

/**
 * Object of this class represents one Item. Item object includes information such
 * like weight, name, profit
 * @author Administrator
 */
public class Item {

    private int weight;
    private String name;
    private int profit;

    /**
     * Consturctor without parametrs
     */
    Item() {
    }

    /**
     *
     * @param name Item name
     * @param profit item profit - value
     * @param weight item weight
     */
    Item(String name, int profit, int weight) {
        this.weight = weight;
        this.name = name;
        this.profit = profit;
    }

    /**
     * Set weight
     * @param w weigt
     */
    public void setWeight(int w) {
        this.weight = w;
    }

    /**
     * Set profit
     * @param profit profit
     */
    public void setProfil(int profit) {
        this.profit = profit;
    }

    /**
     * return profit
     * @return profit
     */
    public int getProfit() {
        return this.profit;
    }

    /**
     * Return weight
     * @return weight
     */
    public int getWeight() {
        return this.weight;
    }

    /**
     * return Name
     * @return name
     */
    public String getName() {
        return this.name;
    }

    /**
     * Return information about item as string
     * @return return information about item as string
     */
    @Override
    public String toString()
    {
       // String result = new String();
      //  result.format("%-10s ", this.name);
        //System.out.println(result);
   return this.name + ", p: " +this.profit + ", w: " +this.weight;

        //return result;
        //String out = new String();
        //Formatter for = new Formatter(out);
               // System.out.format("%-10s %-10s %-10s", this.name, this.weight,this.profit);
               // return "";
    }
}
